package com.libreaccess.reporting.beans;

import java.sql.SQLException;
import java.util.List;

import javax.naming.NamingException;

import com.libredigital.reporting.schema.MyReport;
import com.libredigital.reporting.schema.OutputFormat;
import com.libredigital.reporting.schema.Report;
import com.libredigital.reporting.schema.ReportDS;
import com.libredigital.reporting.schema.ReportView;
import com.libredigital.reporting.schema.Response;
import com.libredigital.reporting.schema.ReportResource;

public interface ReportsDAO {
	Report getById(Long id) throws NamingException, SQLException;
	
	ReportResource getResourceByFullName(String fullName) throws NamingException, SQLException;

	List<Report> getAllReports() throws NamingException, SQLException;

	Response deleteReport(long reportId) throws NamingException, SQLException;
	
	List<ReportView> getAllViewsByReport(long reportId) throws NamingException, SQLException;
	
	ReportView getReportViewById(Long id) throws NamingException, SQLException;
	
	List<OutputFormat> getAllReportViewFormats() throws NamingException, SQLException;
	
	List<OutputFormat> getReportViewFormatsByViewId(Long id) throws NamingException, SQLException;
	
	Response setReportViewFormatsByViewId(long viewId, List<String> frms) throws NamingException, SQLException;
	
	Long setLogMaster(long viewId, String userName, String params) throws NamingException, SQLException;
	
	Response setLogDetail(long logId, long resId) throws NamingException, SQLException;
	
	Response addResource(String type, String fullName, byte[] content, byte[] subreport) throws NamingException, SQLException;
	
	ReportDS getReportDSById(Long id) throws NamingException, SQLException;
	
	Response saveMyReport(String name, String userName, long viewId, byte[] parameters, long myReportId) throws NamingException, SQLException;
	
	Response updateMyReportByTrigger(long myReportId, byte[] parameters) throws NamingException, SQLException;
	
	Response deleteMyReport(long myReportId) throws NamingException, SQLException;
	
	MyReport getMyReportById(long id)throws NamingException, SQLException;
	
	MyReport getMyReportByNameAndLoggedUserId(String name, String userName)throws NamingException, SQLException;
	
	List<MyReport> getAllMyReportsByUser(String userName)throws NamingException, SQLException;
}
